import 'package:flutter/material.dart';
import 'package:flutterzhuyili/page/ball/ballGame.dart';
import 'package:flutterzhuyili/page/gameSelect.dart';
import 'package:flutterzhuyili/page/infomation.dart';
import 'package:flutterzhuyili/page/me.dart';
import 'file:///D:/flutterGame/flutter_zhuyili/lib/page/shuerte/shuerteCustomPage.dart';
import 'file:///D:/flutterGame/flutter_zhuyili/lib/page/shuerte/shuerteMain.dart';
import 'package:flutterzhuyili/page/splash.dart';
import 'package:flutterzhuyili/widgets/customWidgets.dart';

///@author xuziqiang
/// @date 2020/8/3 9:55
///
///

const String RouterSplashPage = "/splash";
const String RouterShuerteMainPage = "/shuerteMain";
const String RouterShuerteCustomPage = "/shuerteCustom";
const String RouterShuertePage = "/shuerte";
const String RouterMainPage = "/main";
const String RouterGameSelectPage = "/gameSelect";
const String RouterBallPage = "/ball";
const String RouterMePage = "/me";
const String RouterInfomationPage = "/infomation";
final routes = {
  RouterSplashPage: (ctx) => SplashPage(),
  RouterShuerteMainPage: (ctx) => ShuerteMainPage(),
  RouterShuerteCustomPage: (ctx) => ShuerteCustomPage(),
  RouterGameSelectPage: (ctx) => GameSelectPage(),
  RouterBallPage: (ctx) => BallPage(),
  RouterMePage: (ctx) => Me(),
  RouterInfomationPage: (ctx, {arguments}) =>
      InfomationPage(arguments: arguments),
};

//固定写法
// ignore: top_level_function_literal_block
var onGenerateRoute = (RouteSettings settings) {
  // 统一处理
  final String name = settings.name;
  final Function pageContentBuilder = routes[name];
  if (pageContentBuilder != null) {
    if (settings.arguments != null) {
      final Route route = MaterialPageRoute(
          builder: (context) =>
              pageContentBuilder(context, arguments: settings.arguments));
      return route;
    } else {
      final Route route =
          MaterialPageRoute(builder: (context) => pageContentBuilder(context));
      return route;
    }
  }
  return null;
};
